package day0320;

import java.util.Arrays;

public class Test10 {
    public static void main(String[] args) {
        int[]  a={};
        for (int i = 0; i < 5; i++) {
            a=Arrays.copyOf(a, a.length+1);//先把数组扩容1位
            a[i]= (int)(Math.random()*50);//再放入一个小于50的随机数
        }
        System.out.println(Arrays.toString(a));
    }
}


//Random r=new Random();
//r.nextInt(50);


//(int)(Math.random()*50)  //  [0.0*50 ,  1.0*50)
